<div class="col-md-9">
  <div class="thumbnail">
    <!-- breadcrumb -->
    <ol class="breadcrumb breadcrumb-arrow">
      <li><a href="{:U(GROUP_NAME . '/Rbac')}">RBAC</a></li>
      <li class="active"><span>添加用户</span></li>
    </ol>

    <h3 class="text-center">添加用户</h3>
    <form class="form-horizontal" role="form" method="post" action="{:U(GROUP_NAME . '/Rbac/addUserHandle')}">
      <!-- 用户名称 -->
      <div class="form-group">
        <label for="name" class="col-sm-2 control-label">用户名称</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" name="p_name" placeholder="名称">
        </div>
      </div>
      <!-- 密码 -->
      <div class="form-group">
        <label for="title" class="col-sm-2 control-label">用户密码</label>
        <div class="col-sm-6">
          <input type="hidden" name="password" value="123456">
          <input type="text" class="form-control" value="初始密码为 123456" readonly>
        </div>
      </div>
      <!-- 邮箱 -->
      <div class="form-group">
        <label for="email" class="col-sm-2 control-label">邮箱</label>
        <div class="col-sm-6">
          <input type="email" class="form-control" name="email" id="email" placeholder="邮箱">
        </div>
      </div>
      <!-- 学号 -->
      <div class="form-group">
        <label for="s_id" class="col-sm-2 control-label">学号</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" name="s_id" id="s_id" placeholder="学号">
        </div>
      </div>

      <!-- 是否开启 -->
      <div class="form-group">
        <label for="title" class="col-sm-2 control-label">开启状态</label>
        <div class="col-sm-6">
          <div class="radio-inline">
            <label><input type="radio" name="status" value="1" checked>&nbsp;开启</label>
          </div>
          <div class="radio-inline">
            <label><input type="radio" name="status" value="0">&nbsp;关闭</label>
          </div>
        </div>
      </div>
      <!-- 所属角色 -->
      <div class="form-group" id="add-role-group">
        <label for="title" class="col-sm-2 control-label">所属角色</label>
        <div class="col-sm-7">
          <input type="button" class="btn" id="add-role" value="添加一个角色">
          <select class="form-control" id="select" name="role_id[]">
            <volist name="role" id="r">
              <option value="{$r.id}">{$r.name}({$r.remark})</option>
            </volist>
          </select>
        </div>
      </div>

      <div class="form-group" id="last">
        <br>
        <div class="col-sm-offset-2 col-sm-10">
          <a href="{:U(GROUP_NAME . '/Rbac/addUser')}">取消添加</a>
          <button type="submit" class="btn btn-primary">保存添加</button>
        </div>
      </div>
    </form>
  </div>
</div>

<script>
  $(function () {
    $('#add-role').click(function () {
      var obj = $('#add-role-group').clone();
      obj.find('#add-role').remove();
      $('#last').before(obj);
    });
  });
</script>